For those runing Windows Server 2012 R2/Windows 8.1 and newer. There is a built in cmdlet in powershell that combinds ping,telnet and tracert Test-NetConnection. One drawback I have is that when testing TCP-ports is that you don´t have a timeout value, and the builtin timeout value is 21 seconds, witch is the same as with Telnet. I will come back to this timeout in a later post.

NB ON Server 2016 the cmdlet is updated with a new feature NetRouteDiagnostics, and that does not exist on 2012 R2.

So go ahead and check the documentation at Technet Server 2012 R2 and for Server 2016. Below are the Examples from the 2012 R2 Technet.

 

Example 1: Test a connection

This command tests a network connection.

PS C:\> Test-NetConnection

Example 2: Test a connection and display detailed results

This command tests a network connection and sets the InformationLevel parameter to Detailed.

PS C:\> Test-NetConnection -Port 80 -InformationLevel Detailed

Example 3: Test a connection to a remote host

This command tests a network connection to a remote host named www.contoso.com.

PS C:\> Test-NetConnection -ComputerName www.contoso.com -InformationLevel Detailed